package com.yami.shop.api.controller;

import com.yami.shop.bean.model.CashOut;
import com.yami.shop.security.util.SecurityUtils;
import com.yami.shop.service.CashOutService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/application")
public class CashOutController {
    @Autowired
    private CashOutService cashOutService;

    @GetMapping("/cashOutApplication")
    public ResponseEntity<String> cashOutApplication(String bankAccount,String name,String withdrawAmount,String bankName){
        //申请提现时,先扣除账户余额
        String userId = SecurityUtils.getUser().getUserId();
        cashOutService.dealCashOut(name,bankAccount,withdrawAmount,userId,bankName);
        return ResponseEntity.ok("success");
    }

}
